/*
Copyright (c) 2008, www.igorcosta.com

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * */
package br.absolutobrasil.utils
{
		/**
	 * Classe util para medição de pesos de acordo com as médias Brasileiras
	 * 
	 * Médias usadas nessa classe:
	 * Pesos
						1 quilate 	199mg 	3.07gr.
						1 onça 	28,691g 	1.012oz.
						1 libra 	459,5g 	1.013lb.
						1 arroba 	14,689kg 	32.38lb.
						1 quintal 	58,758kg 	129.50lb.
						1 tonelada 	793,238kg 	1,748.70lb.
	 * */
	public class PesosUtil
	{
		include "../core/Versao.as";	
				public function PesosUtil(){
					
				}
				public static function arrobaMetricaToKg(valor:int):int
				{
									valor = valor * 15;
									return valor;
				}
				public static function kgToArrobaMetrica(valor:int):int
				{
									valor = valor/15;
									return valor;
				}
				public static function tonelaToKg(valor:Number):Number
				{
									valor = valor * 793.238;
									return valor;
				}
				public static function kiloToTonelada(valor:Number):Number
				{
								valor = valor / 793.238;
								return valor;
				}
				public static function quintalToKg(valor:Number):Number
				{
							valor = valor * 58.758;
							return valor;
				}
				public static function kilosToQuintal(valor:Number):Number
				{
									valor = valor / 58.758;
									return valor;
				}
				public static function libraToGrama(valor:int):int
				{
								valor = valor * 459.5;
								return valor;
				}
				public static function gramaToLibra(valor:int):int
				{
									valor = valor / 459.5;
									return valor;
				}
				public static function oncaToGrama(valor:int):int
				{
								valor = valor * 28.691;
								return valor;
				}
				public static function gramaToOnca(valor:int):int
				{
								valor  = valor / 28.691;
								return valor;
				}
				 public static function quilateToMiligrama(valor:int):int
				 {
				 				valor = valor * 199;
				 				return valor;
				 }
				 public static function miligramaToQuilate(valor:int):int
				 {
				 				valor = valor/199;
				 				return valor;
				 }
				 public static function arrobaToKg(valor:Number):Number
				 {
				 				valor = valor *14.689;
				 				return valor;
				 }
				 public static function kgToArroba(valor:Number):Number
				 {
				 				valor = valor/14.689;
				 				return valor;
				 }
				 public static function kgToGrama(valor:Number):Number
				 {
				 					valor = valor *1000;
				 					return valor;
				 }
				 public static function gramaToKg(valor:Number):Number
				 {
				 				valor = valor / 1000;
				 				return valor;
				 }
	}
}